home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1999 Spring / macformat-077.iso / Shareware Plus / Development / Akua Sweets 131 / Akua Sweets Examples / System / Jasik's Patch for 8.5⁄8.51 < prev    next >
Encoding:
Text File  |  1999-03-04  |  2.5 KB  |  75 lines  |  [TEXT/ToyS]

  1. (*
  2. Jasik (20.Feb.99):
  3.  
  4. The manifestation of the bug is random tromping of memory, and sometimes it corrupts the heap
  5. (this happens when an Application is launched). The problem is that some programmer did a Load
  6. Contents when he meant to do a Load Address. The fix is as follows: 
  7.  
  8. Make a copy of the system file, and open it in a resource editor. Open up the
  9. 'nlib', id = 11 resource (name = NQDResidentCursor ) 
  10.  
  11. Either do a Find Hex for the pattern '0844' or goto offset $1968 in the resource. 
  12.  
  13. You should see:  83A0 0844 7FC9 03A6
  14.  
  15.  CHANGE IT TO:   3BA0 0844 7FC9 03A6
  16.  
  17. Save the file, play the appropriate games to replace the fixed System file
  18. [for] the running System file, and re-boot.
  19. *)
  20.  
  21. property kasRType : "nlib"
  22. property kasRNum : 11
  23. property kasOffset : hex convert source "1968" with integer return
  24. property kasSrc : "83A008447FC903A6"
  25. property kasDst : "3BA008447FC903A6"
  26. property kasHexOffset : kasOffset * 2 -- 2 hex characters for each data byte
  27. property kasHexBeg : (kasHexOffset + 1) -- Add 1 since substrings are off 1
  28. property kasHexEnd : (kasHexOffset + (length of kasDst))
  29.  
  30.  
  31. on run
  32.     if option key down of (input state) then
  33.         try
  34.             set nlib to the resource in (choose file) of type kasRType numbered kasRNum
  35.         on error errStr
  36.             ShowError("The resource could not be loaded from the file you chose." & return & return & "(Error: " & errStr & ")")
  37.         end try
  38.     else
  39.         try
  40.             set nlib to the resource of type kasRType numbered kasRNum
  41.         on error errStr
  42.             ShowError("The Jasik 85 patch does not apply to the running system." & return & return & "(Error: " & errStr & ")")
  43.         end try
  44.     end if
  45.     
  46.     set nlibHex to encode nlib in hexadecimal
  47.     set patchText to the text from character kasHexBeg to kasHexEnd of nlibHex
  48.     
  49.     if (patchText is kasSrc) then
  50.         -- Insert our data
  51.         set nlibHex to replace data in nlibHex starting after position kasHexOffset with contents of kasDst
  52.         -- Compile it
  53.         set nlib to encode nlibHex from hexadecimal as (class of nlib)
  54.         -- Save it
  55.         save resource nlib numbered kasRNum
  56.         ShowNote("The patch has been applied to this System." & return & return & "Restart the machine to have it take effect.")
  57.     else if (patchText is kasDst) then
  58.         ShowNote("The patch has already been applied to this System.")
  59.     else
  60.         ShowError("The Jasik 85 patch does not apply to the running system." & return & return & "(Code: " & patchText & ")")
  61.     end if
  62. end run
  63.  
  64.  
  65.  
  66. on ShowNote(msg)
  67.     display dialog msg with icon note buttons {"OK"} default button 1
  68. end ShowNote
  69.  
  70.  
  71.  
  72. on ShowError(msg)
  73.     display dialog msg with icon stop buttons {"Cancel"} default button 1
  74. end ShowError
  75.